import { createRouter, createWebHashHistory } from 'vue-router'
import type { RouteRecordRaw } from 'vue-router';
import BasicLayout from "@/layout/BasicLayout.vue"
import PageLayoutVue from '@/layout/PageLayout.vue';
import Home from "@/views/Home.vue"
import {testRouter} from "@/router/modelTest";

// createWebHistory(import.meta.env.BASE_URL)
export const routes: RouteRecordRaw[] = [
  {
    path:'/app/loong3',
    name: 'app',
    component: BasicLayout,
    redirect:"/app/loong3/home",
    meta: { title: '首页', hideInMenu: false },
    children:[
      {
        path: '/app/loong3/home',
        component: Home,
        name: 'home',
        meta: {
          title: '首页',
          keepAlive: false,
          hideInBreadcrumb: true,
        }
      },
      {
        path: '/app/loong3/system',
        component: PageLayoutVue,
        name: 'system',
        redirect:"/app/loong3/system/menu",
        meta: { title: '系统管理',hideInMenu: false,wrappers:['@/wrappers/auth']},
        children:[
          {
            path: '/app/loong3/system/menu',
            component:()=>import("../views/system/Menu.vue"),
            name: 'system-menu',
            meta:{
              title:"菜单管理",
              keepAlive: false,
            }
          },
          {
            path: '/app/loong3/system/oper',
            component:()=>import("../views/system/Oper.vue"),
            name: 'system-oper',
            meta:{
              title:"操作日志",
              keepAlive: false,
            }
          },
          {
            path: '/app/loong3/system/role',
            component:()=>import("../views/system/Role.vue"),
            name: 'system-role',
            meta:{
              title:"角色管理",
              keepAlive: false,
            }
          },
          {
            path: '/app/loong3/system/user',
            component:()=>import("../views/system/User.vue"),
            name: 'system-user',
            meta:{
              title:"用户管理",
              keepAlive: false,
            }
          },
          {
            path: '/app/loong3/system/dept',
            component:()=>import("../views/system/Dept.vue"),
            name: 'system-dept',
            meta:{
              title:"部门管理",
              keepAlive: false,
            }
          },
        ]
      },
      testRouter
    ]
  },
  {
    path: '/login',
    component:()=>import("../views/Login.vue"),
    name: 'login',
    meta:{
      title:"登录",
      keepAlive: false,
    }
  },
  {
    path:'/',
    redirect:"/app/loong3/home"
  }
]


const router = createRouter({
  history: createWebHashHistory(),
  routes
})

export default router
